<table class="easyui-datagrid" id="historyList" data-options="url:'grant/list',fit:true,singleSelect:true,
	fitColumns:true,rownumbers:true,pagination:true,pageSize:20,pageList:[20,50,100,200,500,1000],toolbar:'#historyToolbar'">
	<thead>
        <tr>
            <th data-options="field:'xm',width:$(this).width() * 0.1,halign:'center'">姓名</th>
            <th data-options="field:'lqyxsmc',width:$(this).width() * 0.2,halign:'center'">所在系</th>
            <th data-options="field:'scholarshipName',width:$(this).width() * 0.2,halign:'center'">奖助学金</th>
            <th data-options="field:'levelName',width:$(this).width() * 0.1,align:'center'">等级</th>
            <th data-options="field:'money',width:$(this).width() * 0.05,align:'center'">奖金</th>
            <th data-options="field:'grantTime',width:$(this).width() * 0.2,align:'center'">发放时间</th>
        </tr>
    </thead>
</table>

<div id="historyToolbar">
<table cellspacing="0" cellpadding="0">
	<tbody><tr>
		<td>奖助学金:<select id="scholarshipType2" class="select"></select></td>
		<td><div class="datagrid-btn-separator"></div></td>
		<td>所在系:<select id="collegeType2" class="select"></select></td>
		<td><div class="datagrid-btn-separator"></div></td>
	</tr>
	<tr>
	<td>姓名/学号:<input type="text" id="xmOrxh" class="txtInput" style="width:60px;"></td>
		<td><div class="datagrid-btn-separator"></div></td>
		<td>时间:
		<input class="Wdate" id='startdate2' type="text" style="width:96px;" onFocus="WdatePicker({isShowClear:false,readOnly:true})"/> 
		 - <input class="Wdate" id='enddate2' type="text" style="width:96px;" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'startdate2\')}',isShowClear:false,readOnly:true})"/>
		</td>
		<td><div class="datagrid-btn-separator"></div></td>
		<td><a href="javascript:void(0)" class="easyui-linkbutton" id="hisQueryButton" data-options="iconCls:'icon-remove'">查询</a></td>
	</tr>
	</tbody>
</table>
</div>
<script type="text/javascript" src="statics/js/My97DatePicker/WdatePicker.js"></script>
<script>
$(function() {
	
	$.ajax({
		url:'uni/scholars',
		success:function(scholarshipTypes) {
			//显示奖助学金列表
			var options = $.map(scholarshipTypes,function(row) {
				return '<option value="' + row.id + '">' + row.name + '</option>';
			}).join('');
			$('#scholarshipType2').html('<option value="-">---不限---</option>' + options);
		}
	});
	
	$.ajax({
		url:'uni/colleges',
		success:function(scholarshipTypes) {
			var options = $.map(scholarshipTypes,function(row) {
				return '<option value="' + row.lqyxsm + '">' + row.lqyxsmc + '</option>';
			}).join('');
			$('#collegeType2').html('<option value="-">---不限---</option>' + options);

			$.ajax({
				url:'user/info',
				success:function(result) {
					if(result.userType == 1) {//学生
						$('#collegeType2').val(result.user.lqyxsm).attr('disabled',true);
						$('#xmOrxh').val(result.user.xm).attr('disabled',true);
					}
				}
			});
		}
	});
	

	$('#hisQueryButton').click(function(){
		$('#historyList').datagrid('reload',
			{startdate:$('#startdate2').val(),enddate:$('#enddate2').val(),xh:$('#xmOrxh').val(),
			lqyxsm:$('#collegeType2').val(),scholarshipId:$('#scholarshipType2').val()});
	});
});
</script>